import request from '@/utils/request'

// 新增任免管理
export function addElection(data) {
  return request({
    url: '/system/election',
    method: 'post',
    data: data
  })
}
// 查询界次管理下拉框
export function sessionList() {
  return request({
    url: '/system/session/list',
    method: 'get',
  })
}
// 获取部门列表
export function deptList() {
  return request({
    url: '/system/dept/list',
    method: 'get',
  })
}

// 查询任免管理列表
export function electionList(params) {
  return request({
    url: '/system/election/list',
    method: 'get',
    params
  })
}
// 删除任免管理
export function electionDelete(ids) {
  console.log("ids", ids);
  return request({
    url: `/system/election/${ids}`,
    method: 'delete',
  })
}
// 修改任免管理
export function editElection(data) {
  return request({
    url: '/system/election',
    method: 'put',
    data: data
  })
}
// 获取数据导入的模板
export function importTemplate() {
  return request({
    responseType: 'blob',
    url: '/system/election/importTemplate',
    method: 'post',
  })
}

//  新增任免制度
export function institution(data) {
  return request({
    url: '/system/institution',
    method: 'post',
    data: data
  })
}
//  修改任免制度
export function updateInstitution(data) {
  return request({
    url: '/system/institution',
    method: 'put',
    data: data
  })
}
// 查询任免制度
export function institutionList(query) {       
  return request({
    url: '/system/institution/list',
    method: 'get',
    params: query
  })
}
// 删除任免制度
export function deleteInstitution(ids) {
  return request({
      url: '/system/institution/' + ids,
      method: 'delete',
  })
}
//  历届任免人数统计
export function electionCount() {    
  return request({
    url: '/system/election/count',
    method: 'get',
  })
}